﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QLBenhVien
{
    public partial class frmThongTinBenhNhan : Form
    {        
        public frmThongTinBenhNhan(int id = 0)
        {
            InitializeComponent();
        }
        
        private void btLuu_Click(object sender, EventArgs e)
        {
            DBOBenhNhan o = new DBOBenhNhan();
            if (txtID.Text.Length > 0)
            {
                o.id = int.Parse(txtID.Text);
            }            
            o.hoten = txtHoten.Text;
            if (rdNam.Checked)
            {
                o.gioitinh = 1;
            }
            else
            {
                o.gioitinh = 0;
            }
            o.ngaysinh = DateTime.Parse(dtpNgaySinh.Text);
            o.sodienthoai = txtSodienthoai.Text;
            o.cmnd = txtCmnd.Text;
            o.diachi = txtDiachi.Text;
            o.bhyt = txtBhyt.Text;
            o.Save();            
            this.DialogResult = DialogResult.OK;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
